package com.ouc.openplatform.zykt.authManage.service.impl;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ouc.openplatform.pojo.EUDataGridResult;
import com.ouc.openplatform.zykt.authManage.dao.NJ_RoleAuthorityDAO;
import com.ouc.openplatform.zykt.authManage.model.NJ_RoleAuthority;
import com.ouc.openplatform.zykt.authManage.service.NJ_RoleAuthorityService;
import com.ouc.openplatform.zykt.authManage.vo.NJ_RoleAuthorityVo;
public class NJ_RoleAuthorityServiceImpl implements NJ_RoleAuthorityService{
	
	private NJ_RoleAuthorityDAO nj_roleAuthorityDao;
	
	public NJ_RoleAuthorityDAO getNj_roleAuthorityDao() {
		return nj_roleAuthorityDao;
	}

	public void setNj_roleAuthorityDao(NJ_RoleAuthorityDAO nj_roleAuthorityDao) {
		this.nj_roleAuthorityDao = nj_roleAuthorityDao;
	}
	//1.
	@Override
	public int saveRoleAuthority(NJ_RoleAuthority roleAuthority){
		int flag = nj_roleAuthorityDao.insert(roleAuthority);
		return flag;
	}
	//2.
	@Override
	public int deleteRoleAuthority(int id){
		int flag=nj_roleAuthorityDao.deleteByPrimaryKey(id);
		return flag;
	}
	//3.
	@Override
	public int updateRoleAuthority(NJ_RoleAuthority roleAuthority){
		int flag=nj_roleAuthorityDao.updateByPrimaryKeySelective(roleAuthority);
		return flag;
	}
	//4.
	@Override
	public EUDataGridResult getAllRoleAuthority(NJ_RoleAuthority roleauthority,int page, int rows){
		//分页处理
		PageHelper.startPage(page, rows);
		List<NJ_RoleAuthority> select = nj_roleAuthorityDao.select(roleauthority);
		//创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(select);
		//取记录总条数
		PageInfo<NJ_RoleAuthority> pageInfo = new PageInfo<NJ_RoleAuthority>(select);
		result.setTotal(pageInfo.getTotal());
		return result;
	}
	@Override
	public List<NJ_RoleAuthority> getRoleAuthority(NJ_RoleAuthority roleauthority) {
		return nj_roleAuthorityDao.select(roleauthority);
	}
    //5.
	@Override
	public List<NJ_RoleAuthorityVo> getAllJoinRoleAuthorityByroleid(int roleid){
		List<NJ_RoleAuthorityVo> nj_joinRoleAuthorityList = nj_roleAuthorityDao.getAllJoinRoleAuthorityByroleid(roleid);
		return nj_joinRoleAuthorityList;
	}

	
	
	
	
	
	
}
